home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / text / cmanual.lzh / ACM2.lzh / Requesters / Example7.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  22KB  |  570 lines

  1. /* Example7                                                             */
  2. /* This program will open a normal window which is connected to the     */
  3. /* Workbench Screen. The window will use all System Gadgets, and will   */
  4. /* close first when the user has selected the System gadget Close       */
  5. /* window. Inside the window we have activated an Application requester */
  6. /* with three connecting gadgets. Two are Boolean gadgets ("OK and      */
  7. /* "CANCEL"), and one is a String gadget.                               */
  8.  
  9.  
  10.  
  11. #include <intuition/intuition.h>
  12.  
  13.  
  14.  
  15. struct IntuitionBase *IntuitionBase;
  16.  
  17.  
  18.  
  19. /***********************************/
  20. /* THE STRING GADGET's STRUCTURES: */
  21. /***********************************/
  22.  
  23. /* The coordinates for the box around the string gadget: */
  24. SHORT string_border_points[]=
  25. {
  26.    -7, -4, /* Start at position (-7, -4) */
  27.   200, -4, /* Draw a line to the right to position (200,-4) */
  28.   200, 11, /* Draw a line down to position (200,11) */
  29.    -7, 11, /* Draw a line to the left to position (-7,11) */
  30.    -7, -4  /* Finish of by drawing a line up to position (-7,-4) */ 
  31. };
  32.  
  33. /* The Border structure for the string gadget: */
  34. struct Border string_border=
  35. {
  36.   0, 0,                 /* LeftEdge, TopEdge. */
  37.   1,                    /* FrontPen, colour register 1. */
  38.   0,                    /* BackPen, for the moment unused. */
  39.   JAM1,                 /* DrawMode, draw the lines with colour 1. */
  40.   5,                    /* Count, 5 pair of coordinates in the array. */
  41.   string_border_points, /* XY, pointer to the array with the coordinates. */
  42.   NULL,                 /* NextBorder, no other Border structures. */
  43. };
  44.  
  45.  
  46.  
  47. /* The IntuiText structure for the string gadget: */
  48. struct IntuiText string_text=
  49. {
  50.   1,         /* FrontPen, colour register 1. (white) */
  51.   0,         /* BackPen, not used since JAM1. */
  52.   JAM1,      /* DrawMode, draw the characters with colour 1, and do not */
  53.              /* bother about the background. */ 
  54.   -53, 0,    /* LeftEdge, TopEdge. */
  55.   NULL,      /* ITextFont, use default font. */
  56.   "Name:",   /* IText, the text that will be printed. */
  57.   NULL,      /* NextText, no other IntuiText structures. */
  58. };
  59.  
  60.  
  61.  
  62. UBYTE my_buffer[50]; /* 50 characters including the NULL-sign. */
  63. UBYTE my_undo_buffer[50]; /* Must be at least as big as my_buffer. */
  64.  
  65.  
  66.  
  67. struct StringInfo string_info=
  68. {
  69.   my_buffer,       /* Buffer, pointer to a null-terminated string. */
  70.   my_undo_buffer,  /* UndoBuffer, pointer to a null-terminated string. */
  71.                    /* (Remember my_buffer is equal to &my_buffer[0]) */
  72.   0,               /* BufferPos, initial position of the cursor. */
  73.   50,              /* MaxChars, 50 characters + null-sign ('\0'). */
  74.   0,               /* DispPos, first character in the string should be */
  75.                    /* first character in the display. */
  76.  
  77.   /* Intuition initializes and maintaines these variables: */
  78.  
  79.   0,               /* UndoPos */
  80.   0,               /* NumChars */
  81.   0,               /* DispCount */
  82.   0, 0,            /* CLeft, CTop */
  83.   NULL,            /* LayerPtr */
  84.   NULL,            /* LongInt */
  85.   NULL,            /* AltKeyMap */
  86. };
  87.  
  88.  
  89. struct Gadget string_gadget=
  90. {
  91.   NULL,          /* NextGadget, no more gadgets in the list. */
  92.   68,            /* LeftEdge, 68 pixels out. */
  93.   26,            /* TopEdge, 26 lines down. */
  94.   198,           /* Width, 198 pixels wide. */
  95.   8,             /* Height, 8 pixels lines heigh. */
  96.   GADGHCOMP,     /* Flags, draw the select box in the complement */
  97.                  /* colours. Note: it actually only the cursor which */
  98.                  /* will be drawn in the complement colours (yellow). */
  99.                  /* If you set the flag GADGHNONE the cursor will not be */
  100.                  /* highlighted, and the user will therefore not be able */
  101.                  /* to see it. */
  102.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  103.   RELVERIFY,     /* the user has selected this gadget, and when the user */
  104.                  /* has released it. */ 
  105.   STRGADGET|     /* GadgetType, a String gadget which is connected to */
  106.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  107.                  /* connectd to a requester must have the REQGADGET flsg */
  108.                  /* set in the GadgetType field. */
  109.   (APTR) &string_border, /* GadgetRender, a pointer to our Border struc. */
  110.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  111.                  /* with an alternative image. */
  112.   &string_text,  /* GadgetText, a pointer to our IntuiText structure. */
  113.   NULL,          /* MutualExclude, no mutual exclude. */
  114.   (APTR) &string_info, /* SpecialInfo, a pointer to a StringInfo str. */
  115.   0,             /* GadgetID, no id. */
  116.   NULL           /* UserData, no user data connected to the gadget. */
  117. };
  118.  
  119.  
  120.  
  121. /*******************************/
  122. /* THE OK GADGET's STRUCTURES: */
  123. /*******************************/
  124.  
  125. /* The coordinates for the OK box: */
  126. SHORT ok_border_points[]=
  127. {
  128.    0,  0, /* Start at position (0,0) */
  129.   22,  0, /* Draw a line to the right to position (22,0) */
  130.   22, 10, /* Draw a line down to position (22,10) */
  131.    0, 10, /* Draw a line to the left to position (0,10) */
  132.    0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  133. };
  134.  
  135. /* The Border structure: */
  136. struct Border ok_border=
  137. {
  138.   0, 0,        /* LeftEdge, TopEdge. */
  139.   1,           /* FrontPen, colour register 1. */
  140.   0,           /* BackPen, for the moment unused. */
  141.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  142.   5,           /* Count, 5 pair of coordinates in the array. */
  143.   ok_border_points, /* XY, pointer to the array with the coord. */
  144.   NULL,        /* NextBorder, no other Border structures are connected. */
  145. };
  146.  
  147. /* The IntuiText structure: */
  148. struct IntuiText ok_text=
  149. {
  150.   1,      /* FrontPen, colour register 1. */
  151.   0,      /* BackPen, not used since JAM1. */
  152.   JAM1,   /* DrawMode, draw the characters with colour 1, do not */
  153.           /* change the background. */ 
  154.   4, 2,   /* LeftEdge, TopEdge. */
  155.   NULL,   /* ITextFont, use default font. */
  156.   "OK",   /* IText, the text that will be printed. */
  157.   NULL,   /* NextText, no other IntuiText structures are connected. */
  158. };
  159.  
  160. struct Gadget ok_gadget=
  161. {
  162.   &string_gadget,/* NextGadget, linked to the string gadget. */
  163.   14,            /* LeftEdge, 14 pixels out. */
  164.   47,            /* TopEdge, 47 lines down. */
  165.   23,            /* Width, 23 pixels wide. */
  166.   11,            /* Height, 11 pixels lines heigh. */
  167.   GADGHCOMP,     /* Flags, when this gadget is highlighted, the gadget */
  168.                  /* will be rendered in the complement colours. */
  169.                  /* (Colour 0 (00) will be changed to colour 3 (11) */
  170.                  /* (Colour 1 (01)           - " -           2 (10) */
  171.                  /* (Colour 2 (10)           - " -           1 (01) */
  172.                  /* (Colour 3 (11)           - " -           0 (00) */  
  173.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  174.   RELVERIFY|     /* the user has selected this gadget, and when the user */
  175.                  /* has released it. */
  176.   ENDGADGET,     /* When the user has selected this gadget, the */
  177.                  /* requester is satisfied, and is deactivated. */
  178.                  /* IMPORTANT! At least one gadget per requester */
  179.                  /* must have the flag ENDGADGET set. If not, the */
  180.                  /* requester would never be deactivated! */
  181.  
  182.   BOOLGADGET|    /* GadgetType, a Boolean gadget which is connected to */
  183.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  184.                  /* connectd to a requester must have the REQGADGET flsg */
  185.                  /* set in the GadgetType field. */
  186.   (APTR) &ok_border, /* GadgetRender, a pointer to our Border struc. */
  187.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  188.                  /* with an alternative image. (We complement the */
  189.                  /* colours instead) */
  190.   &ok_text,      /* GadgetText, a pointer to our IntuiText structure. */
  191.                  /* (See chapter 3 GRAPHICS for more information) */
  192.   NULL,          /* MutualExclude, no mutual exclude. */
  193.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  194.                  /* (It is not a Proportional/String or Integer gdget) */
  195.   0,             /* GadgetID, no id. */
  196.   NULL           /* UserData, no user data connected to the gadget. */
  197. };
  198.  
  199.  
  200.  
  201.  
  202. /***********************************/
  203. /* THE CANCEL GADGET's STRUCTURES: */
  204. /***********************************/
  205.  
  206. /* The coordinates for the CANCEL box: */
  207. SHORT cancel_border_points[]=
  208. {
  209.    0,  0, /* Start at position (0,0) */
  210.   54,  0, /* Draw a line to the right to position (54,0) */
  211.   54, 10, /* Draw a line down to position (54,10) */
  212.    0, 10, /* Draw a line to the left to position (0,10) */
  213.    0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  214. };
  215.  
  216. /* The Border structure: */
  217. struct Border cancel_border=
  218. {
  219.   0, 0,        /* LeftEdge, TopEdge. */
  220.   1,           /* FrontPen, colour register 1. */
  221.   0,           /* BackPen, for the moment unused. */
  222.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  223.   5,           /* Count, 5 pair of coordinates in the array. */
  224.   cancel_border_points, /* XY, pointer to the array with the coord. */
  225.   NULL,        /* NextBorder, no other Border structures are connected. */
  226. };
  227.  
  228. /* The IntuiText structure: */
  229. struct IntuiText cancel_text=
  230. {
  231.   1,        /* FrontPen, colour register 1. */
  232.   0,        /* BackPen, not used since JAM1. */
  233.   JAM1,     /* DrawMode, draw the characters with colour 1, do not */
  234.             /* change the background. */ 
  235.   4, 2,     /* LeftEdge, TopEdge. */
  236.   NULL,     /* ITextFont, use default font. */
  237.   "CANCEL", /* IText, the text that will be printed. */
  238.   NULL,     /* NextText, no other IntuiText structures are connected. */
  239. };
  240.  
  241. struct Gadget cancel_gadget=
  242. {
  243.   &ok_gadget,    /* NextGadget, linked to the OK gadget. */
  244.   214,           /* LeftEdge, 214 pixels out. */
  245.   47,            /* TopEdge, 47 lines down. */
  246.   55,            /* Width, 55 pixels wide. */
  247.   11,            /* Height, 11 pixels lines heigh. */
  248.   GADGHCOMP,     /* Flags, when this gadget is highlighted, the gadget */
  249.                  /* will be rendered in the complement colours. */
  250.                  /* (Colour 0 (00) will be changed to colour 3 (11) */
  251.                  /* (Colour 1 (01)           - " -           2 (10) */
  252.                  /* (Colour 2 (10)           - " -           1 (01) */
  253.                  /* (Colour 3 (11)           - " -           0 (00) */  
  254.   GADGIMMEDIATE| /* Activation, our program will recieve a message when */
  255.   RELVERIFY|     /* the user has selected this gadget, and when the user */
  256.                  /* has released it. */
  257.   ENDGADGET,     /* When the user has selected this gadget, the */
  258.                  /* requester is satisfied, and is deactivated. */
  259.                  /* IMPORTANT! At least one gadget per requester */
  260.                  /* must have the flag ENDGADGET set. If not, the */
  261.                  /* requester would never be deactivated! */
  262.  
  263.   BOOLGADGET|    /* GadgetType, a Boolean gadget which is connected to */
  264.   REQGADGET,     /* a requester. IMPORTANT! Every gadget which is */
  265.                  /* connectd to a requester must have the REQGADGET flsg */
  266.                  /* set in the GadgetType field. */
  267.   (APTR) &cancel_border, /* GadgetRender, a pointer to our Border struc. */
  268.   NULL,          /* SelectRender, NULL since we do not supply the gadget */
  269.                  /* with an alternative image. (We complement the */
  270.                  /* colours instead) */
  271.   &cancel_text,  /* GadgetText, a pointer to our IntuiText structure. */
  272.                  /* (See chapter 3 GRAPHICS for more information) */
  273.   NULL,          /* MutualExclude, no mutual exclude. */
  274.   NULL,          /* SpecialInfo, NULL since this is a Boolean gadget. */
  275.                  /* (It is not a Proportional/String or Integer gdget) */
  276.   0,             /* GadgetID, no id. */
  277.   NULL           /* UserData, no user data connected to the gadget. */
  278. };
  279.  
  280.  
  281.  
  282. /************************************************************************/
  283. /* Note:                                                                */
  284. /* Remember that every gadget which is connected to a requester must    */
  285. /* have the flag REQGADGET set in the GadgetType field. Remember also   */
  286. /* that at least one gadget per requester must have the ENDGADGET flag  */
  287. /* set in the Activation field.                                         */
  288. /* In this example we have three gadgets connected to the requester.    */
  289. /* All of them has the REQGADGET flag set, and the OK and CANCEL gadget */
  290. /* has also the ENDGADGET flag set.                                     */
  291. /************************************************************************/
  292.  
  293.  
  294.  
  295. /************************************/
  296. /* THE BORDER AROUND THE REQUESTER: */
  297. /************************************/
  298.  
  299. /* The coordinates for the box around the requester: */
  300. SHORT requester_border_points[]=
  301. {
  302.     0,  0, /* Start at position (0,0) */
  303.   282,  0, /* Draw a line to the right. */
  304.   282, 64, /* Draw a line down. */
  305.     0, 64, /* Draw a line to the left. */
  306.     0,  0  /* Finish of by drawing a line up to position (0,0) */ 
  307. };
  308.  
  309. /* The Border structure for the requester: */
  310. struct Border requester_border=
  311. {
  312.   0, 0,        /* LeftEdge, TopEdge. */
  313.   1,           /* FrontPen, colour register 1. */
  314.   0,           /* BackPen, for the moment unused. */
  315.   JAM1,        /* DrawMode, draw the lines with colour 1. */
  316.   5,           /* Count, 5 pair of coordinates in the array. */
  317.   requester_border_points, /* XY, pointer to the array with the coord. */
  318.   NULL,        /* NextBorder, no other Border structures are connected. */
  319. };
  320.  
  321.  
  322.  
  323. /**********************************/
  324. /* THE TEXT INSIDE THE REQUESTER: */
  325. /**********************************/
  326.  
  327. /* The IntuiText structure used to print some text inside the requester: */
  328. struct IntuiText requester_text=
  329. {
  330.   1,         /* FrontPen, colour register 1. */
  331.   0,         /* BackPen, unused since JAM1. */
  332.   JAM1,      /* DrawMode, draw the characters with colour 1, do not */
  333.              /* change the background. */ 
  334.   14, 8,     /* LeftEdge, TopEdge. */
  335.   NULL,      /* ITextFont, use default font. */
  336.   "Please enter your name:", /* IText, the text that will be printed. */
  337.   NULL,      /* NextText, no other IntuiText structures are connected. */
  338. };
  339.  
  340.  
  341.  
  342. /****************************/
  343. /* THE REQUESTER STRUCTURE: */
  344. /****************************/
  345.  
  346. struct Requester my_requester=
  347. {
  348.   NULL,              /* OlderRequester, used by Intuition. */
  349.   40, 20,            /* LeftEdge, TopEdge, 40 pixels out, 20 lines down. */
  350.   283, 65,           /* Width, Height, 283 pixels wide, 65 lines high. */
  351.   0, 0,              /* RelLeft, RelTop, Since POINTREL flag is not set, */
  352.                      /* Intuition ignores these values. */
  353.   &cancel_gadget,    /* ReqGadget, pointer to the first gadget. */
  354.   &requester_border, /* ReqBorder, pointer to a Border structure. */
  355.   &requester_text,   /* ReqText, pointer to a IntuiText structure. */
  356.   NULL,              /* Flags, no flags set. */
  357.   2,                 /* BackFill, draw everything on a black background. */
  358.   NULL,              /* ReqLayer, used by Intuition. Set to NULL. */
  359.   NULL,              /* ReqPad1, used by Intuition. Set to NULL. */
  360.   NULL,              /* ImageBMap, no predrawn Bitmap. Set to NULL. */
  361.                      /*            (The PREDRAWN flag was not set) */
  362.   NULL,              /* RWindow, used by Intuition. Set to NULL. */
  363.   NULL               /* ReqPad2, used by Intuition. Set to NULL. */
  364. };
  365.  
  366.  
  367.  
  368. /* Declare a pointer to a Window structure: */ 
  369. struct Window *my_window;
  370.  
  371. /* Declare and initialize your NewWindow structure: */
  372. struct NewWindow my_new_window=
  373. {
  374.   0,             /* LeftEdge    x position of the window. */
  375.   0,             /* TopEdge     y positio of the window. */
  376.   640,           /* Width       640 pixels wide. */
  377.   200,           /* Height      200 lines high. */
  378.   0,             /* DetailPen   Text should be drawn with colour reg. 0 */
  379.   1,             /* BlockPen    Blocks should be drawn with colour reg. 1 */
  380.   CLOSEWINDOW|   /* IDCMPFlags  The window will give us a message if the */
  381.                  /*             user has selected the Close window gad, */
  382.   GADGETDOWN|    /*             or a gadget has been pressed on, or */
  383.   GADGETUP|      /*             a gadge has been released. */
  384.   REQSET|        /*             Send a message also if a requester has */
  385.   REQCLEAR,      /*             been activated or deactivated. */
  386.   SMART_REFRESH| /* Flags       Intuition should refresh the window. */
  387.   WINDOWCLOSE|   /*             Close Gadget. */
  388.   WINDOWDRAG|    /*             Drag gadget. */
  389.   WINDOWDEPTH|   /*             Depth arrange Gadgets. */
  390.   WINDOWSIZING|  /*             Sizing Gadget. */
  391.   ACTIVATE,      /*             The window should be Active when opened. */
  392.   NULL,          /* FirstGadget No gadget connected to this window. */
  393.   NULL,          /* CheckMark   Use Intuition's default CheckMark. */
  394.   "The Window",  /* Title       Title of the window. */
  395.   NULL,          /* Screen      Connected to the Workbench Screen. */
  396.   NULL,          /* BitMap      No Custom BitMap. */
  397.   140,           /* MinWidth    We will not allow the window to become */
  398.   50,            /* MinHeight   smaller than 140 x 50, and not bigger */
  399.   300,           /* MaxWidth    than 300 x 200. */
  400.   200,           /* MaxHeight */
  401.   WBENCHSCREEN   /* Type        Connected to the Workbench Screen. */
  402. };
  403.  
  404.  
  405.  
  406. main()
  407. {
  408.   /* Boolean variable used for the while loop: */
  409.   BOOL close_me;
  410.  
  411.   /* Declare a variable in which we will store the IDCMP flag: */
  412.   ULONG class;
  413.   
  414.   /* Declare a variable in which we will store the address of the */
  415.   /* gadget which sent the message: */
  416.   APTR address;
  417.   
  418.   /* Declare a pointer to an IntuiMessage structure: */
  419.   struct IntuiMessage *my_message;
  420.  
  421.   /* We use this variable to check if the requester has ben activated */
  422.   /* or not: */
  423.   BOOL result;
  424.  
  425.  
  426.   /* Before we can use Intuition we need to open the Intuition Library: */
  427.   IntuitionBase = (struct IntuitionBase *)
  428.     OpenLibrary( "intuition.library", 0 );
  429.   
  430.   if( IntuitionBase == NULL )
  431.     exit(); /* Could NOT open the Intuition Library! */
  432.  
  433.  
  434.  
  435.   /* We will now try to open the window: */
  436.   my_window = (struct Window *) OpenWindow( &my_new_window );
  437.   
  438.   /* Have we opened the window succesfully? */
  439.   if(my_window == NULL)
  440.   {
  441.     /* Could NOT open the Window! */
  442.     
  443.     /* Close the Intuition Library since we have opened it: */
  444.     CloseLibrary( IntuitionBase );
  445.  
  446.     exit();  
  447.   }
  448.  
  449.  
  450.  
  451.   /* We have opened the window, and everything seems to be OK. */
  452.  
  453.  
  454.  
  455.   /* We will now try to activate the requester: */
  456.   result=Request( &my_requester, my_window );
  457.  
  458.   if( !result )  /* !result is the same thing as result==FALSE */
  459.   {
  460.     /* Intuition could not activate the requester! */
  461.     /* In this case we do not need to quit since it does not matter if */
  462.     /* the requester was activated or not. I just wanted to show how */
  463.     /* you can check if you have opened or not the requester. */
  464.   
  465.     printf("Could not activate the requester!\n");
  466.   }
  467.   else
  468.   {
  469.     /* Intuition could open the requester! */
  470.     printf("Try to close the window!\n");
  471.   }
  472.  
  473.  
  474.  
  475.   close_me = FALSE;
  476.  
  477.   /* Stay in the while loop until the user has selected the Close window */
  478.   /* gadget. However, in this example the user first need to deactivate */
  479.   /* the requester before he can select the Close window gadget: */
  480.   while( !close_me )
  481.   {
  482.     /* Wait until we have recieved a message: */
  483.     Wait( 1 << my_window->UserPort->mp_SigBit );
  484.  
  485.     /* As long as we collect messages sucessfully: */
  486.     while(my_message=(struct IntuiMessage *) GetMsg(my_window->UserPort))
  487.     {
  488.       /* After we have collected the message we can read it, and save any */
  489.       /* important values which we maybe want to check later: */
  490.       
  491.       /* Store the IDCMP flag: */
  492.       class = my_message->Class;
  493.  
  494.       /* Store the address: */
  495.       address = my_message->IAddress;
  496.  
  497.       /* After we have read it we reply as fast as possible: */
  498.       /* REMEMBER! Do never try to read a message after you have replied! */
  499.       /* Some other process has maybe changed it. */
  500.       ReplyMsg( my_message );
  501.  
  502.       /* Check which IDCMP flag was sent: */
  503.       switch( class )
  504.       {
  505.         case CLOSEWINDOW:  /* The user selected the Close window gadget! */
  506.                close_me=TRUE;
  507.                break;
  508.              
  509.         case GADGETDOWN:   /* The user has pressed on a gadget. */
  510.                
  511.                if( address == (APTR) &ok_gadget )
  512.                  printf("The user pressed on the OK gadget!\n");
  513.  
  514.                if( address == (APTR) &cancel_gadget )
  515.                  printf("The user pressed on the CANCEL gadget!\n");
  516.                  
  517.                if( address == (APTR) &string_gadget )
  518.                  printf("The user selected the string gadget!\n");
  519.                
  520.                break;
  521.              
  522.         case GADGETUP:     /* The user has released a gadget. */
  523.  
  524.                if( address == (APTR) &ok_gadget )
  525.                  printf("The user released the OK gadget!\n");
  526.  
  527.                if( address == (APTR) &cancel_gadget )
  528.                  printf("The user released the CANCEL gadget!\n");
  529.                  
  530.                if( address == (APTR) &string_gadget )
  531.                {
  532.                  printf("The user released the string gadget!\n");
  533.  
  534.                  /* Print out the string: */
  535.                  printf("Name: %s\n\n", my_buffer);
  536.                }
  537.  
  538.                break;
  539.                
  540.         case REQSET:       /* Requester activated. */
  541.               printf("Requester activated!\n");
  542.               break;
  543.  
  544.         case REQCLEAR:     /* Requester deactivated. */
  545.               printf("Requester deactivated!\n");
  546.               printf("You can now close the window.\n");
  547.               break;
  548.       }
  549.     }
  550.   }
  551.  
  552.  
  553.  
  554.   /* Print out the string: */
  555.   printf("Name: %s\n\n", my_buffer);
  556.  
  557.  
  558.  
  559.   /* We should always close the windows we have opened before we leave: */
  560.   CloseWindow( my_window );
  561.  
  562.  
  563.  
  564.   /* Close the Intuition Library since we have opened it: */
  565.   CloseLibrary( IntuitionBase );
  566.   
  567.   /* THE END */
  568. }
  569.  
  570.